package com.doitedu.day02.funcs

import com.doitedu.day02.beans.User

/**
 * @Date 22.6.20
 * @Created by HANGGE
 * @Description
 *             Array中方法
 *             1 map
 *             2 filter
 *             3 foreach
 *             4 length  size
 *             5  min  max   集合中的元可排序
 *             6 maxBy  minBy
 *
 *
 */
object _02数组中的方法 {
  def main(args: Array[String]): Unit = {
    val array = Array[Int](1,2,3,4,5,6,7,8,9)
    array.length
    println(array.max)
    println(array.min)
    val users = Array[User](User(1,"zss") , User(3,"lss") , User(8,"ww") ,User(2,"zl"))
   // println(users.max)
    // 跟据  user.id获取最大
    //val user1 = users.maxBy(user => user.id)
    val user1 = users.minBy(user => user.id)
    println(user1)
  }
}
